<template>
    <div class="hotsalve">
        <div class="title">热销推荐</div>
        <div class="goods-list">
            <div class="goods-wrap" >
                <div 
                class="item" 
                v-for="item in goodsList" :key="item._id"
                @click="goDetails(item)">
                    <img :src="item.src" alt="">
                    <div class="goods-name">{{item.goods_name}}</div>
                    <div class="price"><span>￥</span>{{item.goods_price}}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name:"HotSave-Home",
        props:['goodsList'],
        data(){
            return {
                startY:0,
            }
        },
        methods: {
             // 详情页跳转
            goDetails(item){
                this.$router.push({
                    path:"/details",
                    query:{
                        _id:item._id
                    }
                })
            },
        },
    }
</script>

<style scoped lang="less">
    .hotsalve{
        width: 95%;
        margin: 0 auto;
        padding-top: 2.7vw;
        background: #fff;
        margin-bottom: 1.3vw;
        border-radius: 2.7vw;

        .title{
            font-size: 4.8vw;
            color: #333;
            font-weight: 600;
            margin-left: 3.2vw;
        }

        .goods-list{
            padding: 3vw 0;
            overflow: hidden;

            .goods-wrap{
                display: flex;
                overflow-x: scroll;

                

                .item{
                    width: 29.3vw;
                    margin-right: 2.7vw;
                    flex-shrink: 0;
                    
                    img{
                        width: 100%;
                        height: 26.7vw;
                    }

                    .goods-name{
                        font-size: 3.7vw;
                        width: 100%;
                        text-align: center;
                        font-weight: 600;
                        padding: 1.3vw 0;
                    }

                    .price{
                        width: 90%;
                        text-align: center;
                        color: #F22534;
                        font-weight: 600;
                        font-size: 16px;
                        span{
                            font-size: 3.2vw;
                        }
                    }
                }
            }
        }
    }
</style>